import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)


public class HullPiece16 extends Attachable
{
    //used to render
    boolean init = false;
    
    
    //rotation variables

    //momentum
   
    
    //invisible image and booleans
    private static final GreenfootImage i = new GreenfootImage(1,1);
    private static GreenfootImage box = new GreenfootImage("hullSquare.png");
   
    
    
    
    public HullPiece16(){
    super(0,new GreenfootImage("hullSquare.png"));
    addAttatchmentPoint(new Location(0,8,0));
    addAttatchmentPoint(new Location(8,0,90));
    addAttatchmentPoint(new Location(0,-8,180));
    addAttatchmentPoint(new Location(-8,0,270));
    rotation = 0;
    Play.addons.add(this);
    }
    
    public HullPiece16(int rotation1){
    super(0,new GreenfootImage("hullSquare.png"));
    addAttatchmentPoint(new Location(0,8,0));
    addAttatchmentPoint(new Location(8,0,90));
    addAttatchmentPoint(new Location(0,-8,180));
    addAttatchmentPoint(new Location(-8,0,270));
    rotation = rotation1;
    Play.addons.add(this);
    }
    public HullPiece16(double rotation1){
    super(0,new GreenfootImage("hullSquare.png"));
    addAttatchmentPoint(new Location(0,8,0));
    addAttatchmentPoint(new Location(8,0,90));
    addAttatchmentPoint(new Location(0,-8,180));
    addAttatchmentPoint(new Location(-8,0,270));
    rotationD = rotation1;
    Play.addons.add(this);
    
    }
    
    public void act() 
    {
        if(!init){
          setCoords(getX()-Play.getTrueX(), getY()-Play.getTrueY());
        }
        init = true;
        super.act();
       
        if(init){
        
        setLocation((int)renderX,(int)renderY);
        if(isAttached){
        setRotation(getAttached().getRotation());}
        move(8);
        
        }else{
         X = getX();
         Y = getY();
         init = true;
        }
       
    } 
    
    public void coordUpdate(double x, double y){
    cordX+=x;
    cordY+=y;
    }
}
